package com.mix.controller;

import com.mix.service.RestfulTest;
import com.mix.service.RestfulTestImpl;
import com.mix.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/restful")
public class RestfulTestController {

    @Resource
    RestfulTest restfulTest;

    @Autowired
    RestfulTestImpl restfulTestImpl;

    @RequestMapping("/test")
    public String test() {
        return "restful test";
    }

    @GetMapping("/setRedisTest/{key}/{val}")
    public String setRedisTest(@PathVariable String key, @PathVariable String val) {
        return restfulTest.setRedisTest(key, val);
    }

    @GetMapping("/getRedisTest/{key}")
    public String getRedisTest(@PathVariable String key) {
        return restfulTest.getRedisTest(key);
    }
}
